//
//  WDButton.m
//  CustomLayout
//
//  Created by 王冬 on 2018/6/4.
//  Copyright © 2018年 Morplcp. All rights reserved.
//

#import "WDButton.h"

@implementation WDButton

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat offset = 10.0f;
    self.titleEdgeInsets = UIEdgeInsetsMake(0, -self.imageView.frame.size.width, -self.imageView.frame.size.height-offset/2, 0);
    self.titleLabel.font = [UIFont systemFontOfSize:12];
   // [self setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
   // [self setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];    // button.imageEdgeInsets = UIEdgeInsetsMake(-button.titleLabel.frame.size.height-offset/2, 0, 0, -button.titleLabel.frame.size.width);
    // 由于iOS8中titleLabel的size为0，用上面这样设置有问题，修改一下即可
    self.imageEdgeInsets = UIEdgeInsetsMake(-self.titleLabel.intrinsicContentSize.height-offset/2, 0, 0, -self.titleLabel.intrinsicContentSize.width);
//    CGFloat midX = self.frame.size.width / 2;
//    CGFloat midY = self.frame.size.height/ 2 ;
//    self.titleLabel.center = CGPointMake(midX , midY + 25);
//    self.titleLabel.font =[UIFont systemFontOfSize:12];
//   // self.imageView.center = CGPointMake(midX, midY -10);
//    self.imageView.frame = CGRectMake(midX-35, 0, 70, 70);
    
}


@end
